import { ADD_TO_CART,ADD_COUNT} from './mution_types'

export default {
    getGoodsInfo(context,args){
        return new Promise((resolve,reject)=>{
            let newProduct = context.state.goodsCarts.find(value=> value.id == args.id)
            if(!newProduct){
                context.commit(ADD_TO_CART,args)
                resolve()
            }else{
                context.commit(ADD_COUNT,newProduct)
                resolve()
            }
        })
    }
}